package com.lag.write.demo.controller;

import com.lag.write.demo.service.IDemoService;
import com.lag.write.framework.annotations.LagAutowired;
import com.lag.write.framework.annotations.LagController;
import com.lag.write.framework.annotations.LagRequestMapping;
import com.lag.write.framework.annotations.LagSecurity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author June
 * @since 2021年01月
 */
@LagController
@LagRequestMapping("/demo")
public class DemoController {
    @LagAutowired
    private IDemoService demoService;
    /**
     * URL: /demo/query?name=lisi
     * @param request HttpServletRequest
     * @param response HttpServletResponse
     * @param name 参数
     * @return 结果
     */
    /*@LagRequestMapping("/query")
    public String query(HttpServletRequest request, HttpServletResponse response, String name) {
        return demoService.get(name);
    }*/

    @LagRequestMapping("/security")
    @LagSecurity("[zhangsan,lisi]")
    public String querySecurity(HttpServletRequest request, HttpServletResponse response, String name) {
        return demoService.get(name);
    }
}
